<?php
    require_once dirname(__FILE__) . '/../../utils/Utils.php';
    //引入公共参数
    $constant = include(dirname(__FILE__) . '/../../AppletConstant.php');

	$utils =	new Utils();
	
	/**
	 *   红包 抽奖
	 *
	 */

	//调用地址
	$url = "https://open.95516.com/open/access/1.0/qual.reduce";
	//拼装参数Map
	$params 	=	array();
	$params["appId"] =	 $constant['appId'];

	//活动编号
	$params["activityNumber"] =	 "";

	//订单金额
	$params["orderAmount"] =	 "";

	//资格池编号
	$params["qualNum"] =	 "";

	//资格类型
	//固定值“open_id”、“mobile”、“card_no”
	$params["qualType"] =	 "";

	//资格值
	//（使用symmetricKey 对称加密，内容为base64格式）
	$params["qualValue"] =	 "";

	//身份证号
	//（使用symmetricKey 对称加密，内容为base64格式）
	$params["certId"] =	 "";

	//设备终端
	$params["icTerminal"] =	 "";

	//红包码
	$params["qrCode"] =	 "";

	//流水号（确保唯一）
	$nonceNumber = time().rand("100","999");
	$params["transNumber"] =	$nonceNumber;

	//随机字符串
	$nonceStr = $utils->createNonceStr();
	$params["nonceStr"] =	$nonceStr;

	//时间戳
	$timestamp = time();
	$params["timestamp"] =	$timestamp;
	
	//签名
	$signature = $utils->sign($params, $constant['SIGN_KEY_PACKET']);
    $params["signature"]=$signature;

	//针对敏感字段加密
	$params = $utils->encryptedParamMap($constant['SYMMETRIC_KEY'], $params, array("qualValue", "certId"));
	
	//发送请求
	$resultStr 	=	$utils->sendPostGson($url,$params);
	print_r("-------获取QualReduce信息: ".$resultStr." --------- ");
    exit();
	
?>